package com.co.video.feign;

import com.co.common.entity.Result;
import com.co.video.pojo.Video;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ldl.plus
 * @date 2020年06月22日  0:41
 */
@FeignClient(name = "video")
@RequestMapping("/video")
public interface VideoFeign {

    /**
     * TvVideo分页条件搜索实现
     *
     * @param video
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/search/{page}/{size}")
    Result<PageInfo<Video>> findPage(@RequestBody(required = false) Video video, @PathVariable int page, @PathVariable int size);

    /**
     * TvVideo分页搜索实现
     *
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/search/{page}/{size}")
    Result<PageInfo<Video>> findPage(@PathVariable int page, @PathVariable int size);

    /**
     * 多条件搜索品牌数据
     *
     * @param video
     * @return
     */
    @PostMapping(value = "/search")
    Result<List<Video>> findList(@RequestBody(required = false) Video video);

    /**
     * 根据ID删除品牌数据
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}")
    Result delete(@PathVariable String id);

    /**
     * 修改TvVideo数据
     *
     * @param video
     * @param id
     * @return
     */
    @PutMapping(value = "/{id}")
    Result update(@RequestBody Video video, @PathVariable String id);

    /**
     * 新增TvVideo数据
     *
     * @param video
     * @return
     */
    @PostMapping
    Result add(@RequestBody Video video);

    /**
     * 根据ID查询TvVideo数据
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    Result<Video> findById(@PathVariable String id);

    /**
     * 查询TvVideo全部数据
     *
     * @return
     */
    @GetMapping
    Result<List<Video>> findAll();
}
